import React, { Component } from 'react';
import "../../../styles/Index/Home/Goods.scss"
import * as service from "../../../api/index"

class Goods extends Component {
    constructor(props){
        super(props);
        this.state = {
            goodlist:[]
        }
    }
    async componentDidMount(){
        var res = await service.goodlist();
        console.log(res.data.data);
        this.setState({goodlist:res.data.data})
    }
    render() {
        return (
            <div className='goods'>
                {
                    this.state.goodlist.map((item,index)=>{
                        return (
                            <div className="item" key={index}>
                                <div className="pic">
                                    <img src={item.img1} alt="" />
                                </div>
                                <div className="text">
                                    <div className="name">{item.proname}</div>
                                    <div className="price">￥{item.originprice}</div>
                                </div>
                            </div>
                        )
                    })
                }
                <div className="nomore">
                    没有更多了~~~
                </div>
            </div>
        );
    }
}

export default Goods;